package servlet;

import bean.admin.login.AdminLoginBean;
import util.DealParams;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

@WebServlet("/admin/login")
public class AdminLoginServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setCharacterEncoding("utf-8");
        Map<String,String> params = DealParams.getParamsMap(req);
        PrintWriter out = resp.getWriter();
        String admin_id=params.get("admin_id");
        String admin_pwd = params.get("admin_pwd");
        AdminLoginBean bean = new AdminLoginBean();
        out.print(bean.admin_login(admin_id,admin_pwd));
    }
}
